<?php

use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;

class Employee extends Eloquent implements UserInterface, RemindableInterface {

	use UserTrait, RemindableTrait;
	/**
	 * The database table used by the model.
	 *
	 * @var string
	 */
	protected $table = 'employee';
	protected $fillable = array('account','password');

	/**
	 * 软删除
	 * @var boolean
	 */
	protected $softDelete = true;

	/**
	 * The attributes excluded from the model's JSON form.
	 *
	 * @var array
	 */
	protected $hidden = array('password', 'remember_token');
	/**
	* 调整器：密码
	* @param  string $value 未处理的密码字符串
	* @return void
	*/
	public function setPasswordAttribute($value)
	{
			// 若传入的字符串已经进行了 Hash 加密，则不重复处理
			$this->attributes['password'] = Hash::needsRehash($value) ? Hash::make($value) : $value;
	}
}
